home *** CD-ROM | disk | FTP | other *** search
/ Nejlepší hry / Nejlepsi hry.iso / hry / sea of chaos / sea_install.msi / _15C39AAA7726369D39812BD40F01CF6A / _E9A39D9BD50D44309CEB523485CE869D < prev    next >
Text File  |  2004-11-24  |  976b  |  53 lines

  1. //sky vertex shader:
  2. //moves texture coordinates with time
  3.  
  4. //Luke Lenhart
  5. //(C)2004-2005 Digipen Institute of Technology
  6.  
  7. //world,view,projection transform
  8. float4x4 matWorldViewProj;
  9.  
  10. //current time (in seconds) since whenever
  11. float curTime;
  12.  
  13. //alpha amount of layer
  14. float alpha;
  15.  
  16. //scale level of texture sampling
  17. float scale;
  18.  
  19. //shader input
  20. struct VS_INPUT
  21. {
  22.     float4 Pos : POSITION;
  23.     float4 Color : COLOR;
  24.     float2 Tex0 : TEXCOORD0;
  25. };
  26.  
  27. //shader output
  28. struct VS_OUTPUT
  29. {
  30.     float4 Pos : POSITION;
  31.     float4 Color : COLOR;
  32.     float2 Tex0 : TEXCOORD0;
  33. };
  34.  
  35. //shader code
  36. VS_OUTPUT VShader(VS_INPUT In)
  37. {
  38.     VS_OUTPUT Out;
  39.     
  40.     //calc transformed position
  41.     Out.Pos=mul(matWorldViewProj,In.Pos);
  42.     
  43.     //adjust texture coordinate
  44.     Out.Tex0=scale*(In.Tex0+curTime*float2(0.03f,0.0013f));
  45.     
  46.     //copy color through
  47.     Out.Color=In.Color;
  48.     Out.Color.a*=alpha;
  49.  
  50.     //spit out the results
  51.     return Out;
  52. }
  53.